#include"drv_time.h"
void drv_time_7_init()
{
	TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;
	NVIC_InitTypeDef NVIC_InitStruct;
	TIM_TimeBaseInitStruct.TIM_ClockDivision=TIM_CKD_DIV1;//采样
	TIM_TimeBaseInitStruct.TIM_CounterMode=TIM_CounterMode_Up;//向上计数
	TIM_TimeBaseInitStruct.TIM_Prescaler=8400-1;//预分配系数
	TIM_TimeBaseInitStruct.TIM_Period=10000-1;//装载值
	TIM_TimeBaseInitStruct.TIM_RepetitionCounter=0;//高级定时器专属
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM7,ENABLE);
	TIM_TimeBaseInit(TIM7, &TIM_TimeBaseInitStruct);

	TIM_ITConfig(TIM7,TIM_IT_Update,ENABLE);

	NVIC_InitStruct.NVIC_IRQChannel=TIM7_IRQn;
	NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority=1;
	NVIC_InitStruct.NVIC_IRQChannelSubPriority=0;
	NVIC_InitStruct.NVIC_IRQChannelCmd=ENABLE;
	NVIC_Init(&NVIC_InitStruct);
	TIM_Cmd(TIM7, ENABLE);
}
